// =============================================================================
//  STATS - Statistical Analysis Tools, v.0.01
//  Copyright (C) 2012  Marco Vettigli
// -----------------------------------------------------------------------------
//
// This program  is free software:  you can  redistribute it and/or  modify it
// under the terms of the  GNU General Public License as published by the Free
// Software Foundation,  either version 3 of the License,  or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY;  without even  the  implied  warranty  of  MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License  for
// more details.
//
// You  should  have received a copy of the  GNU General Public License  along
// with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// =============================================================================
//
// DIALOGCOLUMNPROPERTIES.H
// The class defines a graphical user interface for column properties
// modification.
//
// Author: Marco Vettigli
//
// =============================================================================

#ifndef DIALOGCOLUMNPROPERTIES_H
#define DIALOGCOLUMNPROPERTIES_H

// == include directives =======================================================

#include <QDialog>
#include "core/scolproperty.h"

// == class definitions ========================================================

namespace Ui {
    class DialogColumnProperties;
}

class DialogColumnProperties : public QDialog
{
    Q_OBJECT

public:

// == constructors and destructors =============================================

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::DialogColumnProperties(QWidget*)
    //
    // Default constructor for DialogColumnProperties class.
    //
    // -------------------------------------------------------------------------
    explicit DialogColumnProperties(QWidget *parent = 0);

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::~DialogColumnProperties()
    //
    // Default destructor for DialogColumnProperties class.
    //
    // -------------------------------------------------------------------------
    ~DialogColumnProperties();

// == getters ==================================================================

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::getColumnName()
    //
    // Returns the name of the column currently present in the "name" line
    // edit.
    //
    // -------------------------------------------------------------------------
    const QString getColumnName() const;

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::getColumnType()
    //
    // Returns the type of the column currently selected in the "content"
    // combo box.
    //
    // -------------------------------------------------------------------------
    StatS::SColProperty::ArrayType getColumnType() const;

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::getDescription()
    //
    // Returns the description of the column currently present in the
    // "description" text edit.
    //
    // -------------------------------------------------------------------------
    QString getDescription() const;

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::getLsl()
    //
    // Returns the lower spec limit of the column currently present in the
    // "lsl" double spin box.
    //
    // -------------------------------------------------------------------------
    double getLsl() const;

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::getUsl()
    //
    // Returns the upper spec limit of the column currently present in the
    // "usl" double spin box.
    //
    // -------------------------------------------------------------------------
    double getUsl() const;

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::getUnits()
    //
    // Returns the units of the column currently present in the "units" line
    // edit.
    //
    // -------------------------------------------------------------------------
    QString getUnits() const;

// == setters ==================================================================

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::setColumnName(const QString)
    //
    // The function sets the content of line edit "name" with the content of
    // string 'name'. The variable name can be null for setting of multiple
    // column properties.
    //
    // -------------------------------------------------------------------------
    bool setColumnName(const QString name);

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::setColumnType(SColProperty::ArrayType)
    //
    // The function sets the selection of combo box "content" based on 'type'.
    // The variable 'type' can be ArrayType::Undefined for setting of multiple
    // column properties.
    //
    // -------------------------------------------------------------------------
    bool setColumnType(const StatS::SColProperty::ArrayType type);

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::setDescription(const QString)
    //
    // The function sets the content of text edit "description" based on
    // 'description' string.
    //
    // -------------------------------------------------------------------------
    bool setDescription(const QString description);

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::setLsl(double)
    //
    // The function sets the content of the double spin box "lsl" based on
    // 'lsl' string.
    //
    // -------------------------------------------------------------------------
    bool setLsl(double lsl);

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::setUsl(double)
    //
    // The function sets the content of the double spin box "usl" based on
    // 'usl' string.
    //
    // -------------------------------------------------------------------------
    bool setUsl(double usl);

    // -- public ---------------------------------------------------------------
    // DialogColumnProperties::setUnits(const QString)
    //
    // The function sets the content of line edit "units" based on 'units'
    // string.
    //
    // -------------------------------------------------------------------------
    bool setUnits(const QString units);

// == inspectors ===============================================================

// == accessor function declarations ===========================================

// == variable declarations ====================================================

private:

    Ui::DialogColumnProperties *ui;     // user interface pointer

// == private function declarations ============================================

private slots:

    // -- private --------------------------------------------------------------
    // DialogColumnProperties::on_buttonBox_accepted()
    //
    // This fuction handles the button box "OK", accepting and closing the
    // dialog.
    //
    // -------------------------------------------------------------------------
    void on_buttonBox_accepted();

    // -- private --------------------------------------------------------------
    // DialogColumnProperties::on_buttonBox_rejected()
    //
    // This fuction handles the button box "Cancel", rejecting and closing the
    // dialog.
    //
    // -------------------------------------------------------------------------
    void on_buttonBox_rejected();

    // -- private --------------------------------------------------------------
    // DialogColumnProperties::on_comboContent_currentIndexChanged(int)
    //
    // This fuction handles the selection change of the combo box "content",
    // checking consistency of usl and lsl values based on column type. The
    // number 'index' is the selected index.
    //
    // -------------------------------------------------------------------------
    void on_comboContent_currentIndexChanged(int index);

    // -- private --------------------------------------------------------------
    // DialogColumnProperties::on_doubleLSL_valueChanged(double)
    //
    // This fuction handles the value change of the spin box "lsl" and assures
    // consistency with "usl" field. The number 'value' is changed value of the
    // double spin box.
    //
    // -------------------------------------------------------------------------
    void on_doubleLSL_valueChanged(double value);

    // -- private --------------------------------------------------------------
    // DialogColumnProperties::on_doubleUSL_valueChanged(double)
    //
    // This fuction handles the value change of the spin box "usl" and assures
    // consistency with "lsl" field. The number 'value' is changed value of the
    // double spin box.
    //
    // -------------------------------------------------------------------------
    void on_doubleUSL_valueChanged(double value);

};

#endif // DIALOGCOLUMNPROPERTIES_H
